﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace HZ.BidSystem.Model
{
    [Serializable]
    public class SystemConfig
    {
        private static readonly string PATH = "~/Config/SystemConfig.xml";
        /// <summary>
        /// 加密解密方式
        /// 
        /// 0、纯企业参与加解密
        /// 1、中心方参与加解密
        /// </summary>
        public int EncryptType { get; set; }

        /// <summary>
        /// 限价作用方式
        /// 
        /// 0 不提示限价
        /// 1 提示限价，但不强制要求
        /// 2 强制要求限价
        /// </summary>
        public int LimitPriceEffectType { get; set; }


        /// <summary>
        /// 精度
        /// 
        /// 2 保留2位小数，3 保留3位小数
        /// </summary>
        public int Precision { get; set; }

        /// <summary>
        /// 竞价是否看见竞品报价
        /// 
        /// 0 不看
        /// 1 查看
        /// </summary>
        public int CompeteSeeOthers { get; set; }

        /// <summary>
        /// 议价确认方式
        /// 
        /// 0 随意填写价格
        /// 1 只能填专家建议价
        /// </summary>
        public int BargainConfirmType { get; set; }

        /// <summary>
        /// 是否启用三方密码 1 启用 0 不启用
        /// </summary>
        public int UseThreePwd { get; set; }

        #region 加载保存

        /// <summary>
        /// 获取当前序列化对象
        /// </summary>
        public static SystemConfig Instance
        {
            get
            {
                return HZ.Xml.XmlSerialHelper.Deserialize<SystemConfig>(HttpContext.Current.Server.MapPath(PATH));
            }
        }
        /// <summary>
        /// 保存当前配置
        /// </summary>
        public void Save()
        {
            HZ.Xml.XmlSerialHelper.Serialize(HttpContext.Current.Server.MapPath(PATH), this);
        }

        #endregion

    }
}
